/**
* @description  : 历史面单
* @descriptionDetail :历史面单
* @copyright    : gxyc
* @create       : 2024/8/1
*/

<template>
  <div class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar
        :is-white="false"
        :title="navTitle"
        :custom-back="goBack"
        style="z-index: 9999"
    >
    </theme-navbar>
    <!-- #endif -->

    <!-- #ifdef H5-WECHAT || H5-EMP -->
    <fab-button :content="fContent" @fabtrigger="fabtrigger" />
    <!-- #endif -->
    <view class="content">
      <list-view
          :i="0"
          :index="0"
          :top="getListViewTop()"
          :bottom="getListViewBottom()"
          :load-data="myLoadData"
          :init-load="false"
          :noMoreDataTipShow="false"
          ref="mescrollItem0"
      >

        <template slot-scope="d">
          <u-card :showFoot="false" padding="20" :showHead="false" :border="false" margin="20rpx" border-radius="30">
            <bill-info-item slot="body" class="n-lay" :seal-info="d.data" :flag="true"></bill-info-item>
          </u-card>
        </template>

      </list-view>
    </view>
  </div>
</template>
<script>
import listView from "@/components/list_view.vue";
import caseService from "@/service/case/case.service";
import {CASE_TYPE} from "@/service/case/mapping";
import fabButton from "@/components/uni-fab.vue";
import billInfoItem from "./billInfoItem.vue";

export default {
  components: { fabButton, listView, billInfoItem},
  props: {},
  data() {
    return {
      name: '',
      fContent: [{
        iconPath: require('@/static/sou.png'),
        selectedIconPath: require('@/static/sou.png'),
        text: '筛选',
        active: false,
      }],
    }
  },
  onLoad(opt) {
    this.name = opt.name;
    this.myLoadData()
  },
  created() {
  },
  mounted() {
  },
  methods: {
    //  获取列表距离顶部的高度
    getListViewTop() {
      let p = this.$u.sys().statusBarHeight + 'px';
      return p;
    },
    getListViewBottom() {
      return uni.upx2px(120) + 5;
    },
    fabtrigger(btn) {
      if (btn.index == 0) {
        // this.selectCase();
      }
    },
    myLoadData() {
      let self = this;
      return new Promise((resolve) => {
        caseService
            .getLikeNameBillInfo({name: self.name})
            .then((res) => {
              if (res.success) {
                console.log('getLikeNameBillInfo', res)
                let arr = res.data;
                resolve({
                  data: {
                    list: arr,
                    totalCount: res.count,
                  },
                });
              } else {
                self.$modal.alert(res.msg);
                resolve({
                  data: {
                    list: [],
                    totalCount: 0,
                  },
                });
              }
            })
            .catch((err) => {
              self.$modal.alert(err);
              // resolve({
              //   data: {
              //     list: [],
              //     totalCount: 0,
              //   },
              // });
            });
      });
    },
  }
}
</script>

<style scoped lang="scss">

</style>
